package LeetCode.month01.day28;

public class No744 {
    public static void main(String[] args) {
        System.out.println(nextGreatestLetter(new char[]{'c','f','j'},'c'));
    }
    public static char nextGreatestLetter(char[] letters, char target) {
        int left = 0,right = letters.length-1;
        int res = 0;
        while(left<=right){
            int mid = left+(right-left)/2;
            if(letters[mid]>target){
                right=mid-1;
                res = mid;
            }else{
                left=mid+1;
            }
        }
        return letters[res];
    }
}
